<?php
/**
 * Created by PhpStorm.
 * User: wem
 * Date: 2017/3/28
 * Time: 17:40
 */

namespace app\member\validate;


use think\Validate;

class Customer extends Validate
{
    //定义验证规则
    protected $rule = [
        'email|邮箱' => 'require|email|unique:member',
        'password|密码'  => 'require|length:6,20',
        'repassword|重复密码'      => 'require|confirm:password',
    ];

    //定义验证提示
    protected $message = [
        'email.require'    => '邮箱不能为空',
        'email.email'      => '邮箱格式不正确',
        'email.unique'     => '该邮箱已存在',
        'password.require' => '密码不能为空',
        'password.length'  => '密码长度6-16位',
        'repassword.require'     => '重复密码不一致',
        'repassword.confirm' =>'重复密码不一致',
    ];

    //定义验证场景
    protected $scene = [
        //注册
        'register'  =>  ['email', 'password', 'repassword'],
        //登录
//        'signin'  =>  ['username' => 'require', 'password' => 'require'],
    ];
}